<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>IO Channels</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.73.2">
<link rel="start" href="index.html" title="GLib Reference Manual">
<link rel="up" href="glib-core.html" title="GLib Core Application Support">
<link rel="prev" href="glib-Memory-Allocation.html" title="Memory Allocation">
<link rel="next" href="glib-Error-Reporting.html" title="Error Reporting">
<meta name="generator" content="GTK-Doc V1.9 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
<link rel="chapter" href="glib.html" title="GLib Overview">
<link rel="chapter" href="glib-fundamentals.html" title="GLib Fundamentals">
<link rel="chapter" href="glib-core.html" title="GLib Core Application Support">
<link rel="chapter" href="glib-utilities.html" title="GLib Utilities">
<link rel="chapter" href="glib-data-types.html" title="GLib Data Types">
<link rel="chapter" href="tools.html" title="GLib Tools">
<link rel="index" href="ix01.html" title="Index">
<link rel="index" href="ix02.html" title="Index of deprecated symbols">
<link rel="index" href="ix03.html" title="Index of new symbols in 2.2">
<link rel="index" href="ix04.html" title="Index of new symbols in 2.4">
<link rel="index" href="ix05.html" title="Index of new symbols in 2.6">
<link rel="index" href="ix06.html" title="Index of new symbols in 2.8">
<link rel="index" href="ix07.html" title="Index of new symbols in 2.10">
<link rel="index" href="ix08.html" title="Index of new symbols in 2.12">
<link rel="index" href="ix09.html" title="Index of new symbols in 2.14">
<link rel="index" href="ix10.html" title="Index of new symbols in 2.16">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
<tr valign="middle">
<td><a accesskey="p" href="glib-Memory-Allocation.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="glib-core.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">GLib Reference Manual</th>
<td><a accesskey="n" href="glib-Error-Reporting.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr>
<tr><td colspan="5" class="shortcuts"><nobr><a href="#id2983946" class="shortcut">Top</a>
                  &#160;|&#160;
                  <a href="#id2985449" class="shortcut">Description</a></nobr></td></tr>
</table>
<div class="refentry" lang="en">
<a name="glib-IO-Channels"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2>
<a name="id2983946"></a><span class="refentrytitle">IO Channels</span>
</h2>
<p>IO Channels &#8212; portable support for using files, pipes and sockets</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv">
<h2>Synopsis</h2>
<pre class="synopsis">

#include &lt;glib.h&gt;


                    <a class="link" href="glib-IO-Channels.html#GIOChannel">GIOChannel</a>;

<a class="link" href="glib-IO-Channels.html#GIOChannel">GIOChannel</a>*         <a class="link" href="glib-IO-Channels.html#g-io-channel-unix-new">g_io_channel_unix_new</a>               (int fd);
<a class="link" href="glib-Basic-Types.html#gint">gint</a>                <a class="link" href="glib-IO-Channels.html#g-io-channel-unix-get-fd">g_io_channel_unix_get_fd</a>            (<a class="link" href="glib-IO-Channels.html#GIOChannel">GIOChannel</a> *channel);
<a class="link" href="glib-IO-Channels.html#GIOChannel">GIOChannel</a>*         <a class="link" href="glib-IO-Channels.html#g-io-channel-win32-new-fd">g_io_channel_win32_new_fd</a>           (<a class="link" href="glib-Basic-Types.html#gint">gint</a> fd);
<a class="link" href="glib-IO-Channels.html#GIOChannel">GIOChannel</a>*         <a class="link" href="glib-IO-Channels.html#g-io-channel-win32-new-socket">g_io_channel_win32_new_socket</a>       (<a class="link" href="glib-Basic-Types.html#gint">gint</a> socket);
<a class="link" href="glib-IO-Channels.html#GIOChannel">GIOChannel</a>*         <a class="link" href="glib-IO-Channels.html#g-io-channel-win32-new-messages">g_io_channel_win32_new_messages</a>     (<a class="link" href="glib-Basic-Types.html#guint">guint</a> hwnd);

void                <a class="link" href="glib-IO-Channels.html#g-io-channel-init">g_io_channel_init</a>                   (<a class="link" href="glib-IO-Channels.html#GIOChannel">GIOChannel</a> *channel);

<a class="link" href="glib-IO-Channels.html#GIOChannel">GIOChannel</a>*         <a class="link" href="glib-IO-Channels.html#g-io-channel-new-file">g_io_channel_new_file</a>               (const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *filename,
                                                         const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *mode,
                                                         <a class="link" href="glib-Error-Reporting.html#GError">GError</a> **error);
<a class="link" href="glib-IO-Channels.html#GIOStatus">GIOStatus</a>           <a class="link" href="glib-IO-Channels.html#g-io-channel-read-chars">g_io_channel_read_chars</a>             (<a class="link" href="glib-IO-Channels.html#GIOChannel">GIOChannel</a> *channel,
                                                         <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *buf,
                                                         <a class="link" href="glib-Basic-Types.html#gsize">gsize</a> count,
                                                         <a class="link" href="glib-Basic-Types.html#gsize">gsize</a> *bytes_read,
                                                         <a class="link" href="glib-Error-Reporting.html#GError">GError</a> **error);
<a class="link" href="glib-IO-Channels.html#GIOStatus">GIOStatus</a>           <a class="link" href="glib-IO-Channels.html#g-io-channel-read-unichar">g_io_channel_read_unichar</a>           (<a class="link" href="glib-IO-Channels.html#GIOChannel">GIOChannel</a> *channel,
                                                         <a class="link" href="glib-Unicode-Manipulation.html#gunichar">gunichar</a> *thechar,
                                                         <a class="link" href="glib-Error-Reporting.html#GError">GError</a> **error);
<a class="link" href="glib-IO-Channels.html#GIOStatus">GIOStatus</a>           <a class="link" href="glib-IO-Channels.html#g-io-channel-read-line">g_io_channel_read_line</a>              (<a class="link" href="glib-IO-Channels.html#GIOChannel">GIOChannel</a> *channel,
                                                         <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> **str_return,
                                                         <a class="link" href="glib-Basic-Types.html#gsize">gsize</a> *length,
                                                         <a class="link" href="glib-Basic-Types.html#gsize">gsize</a> *terminator_pos,
                                                         <a class="link" href="glib-Error-Reporting.html#GError">GError</a> **error);
<a class="link" href="glib-IO-Channels.html#GIOStatus">GIOStatus</a>           <a class="link" href="glib-IO-Channels.html#g-io-channel-read-line-string">g_io_channel_read_line_string</a>       (<a class="link" href="glib-IO-Channels.html#GIOChannel">GIOChannel</a> *channel,
                                                         <a class="link" href="glib-Strings.html#GString">GString</a> *buffer,
                                                         <a class="link" href="glib-Basic-Types.html#gsize">gsize</a> *terminator_pos,
                                                         <a class="link" href="glib-Error-Reporting.html#GError">GError</a> **error);
<a class="link" href="glib-IO-Channels.html#GIOStatus">GIOStatus</a>           <a class="link" href="glib-IO-Channels.html#g-io-channel-read-to-end">g_io_channel_read_to_end</a>            (<a class="link" href="glib-IO-Channels.html#GIOChannel">GIOChannel</a> *channel,
                                                         <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> **str_return,
                                                         <a class="link" href="glib-Basic-Types.html#gsize">gsize</a> *length,
                                                         <a class="link" href="glib-Error-Reporting.html#GError">GError</a> **error);
<a class="link" href="glib-IO-Channels.html#GIOStatus">GIOStatus</a>           <a class="link" href="glib-IO-Channels.html#g-io-channel-write-chars">g_io_channel_write_chars</a>            (<a class="link" href="glib-IO-Channels.html#GIOChannel">GIOChannel</a> *channel,
                                                         const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *buf,
                                                         <a class="link" href="glib-Basic-Types.html#gssize">gssize</a> count,
                                                         <a class="link" href="glib-Basic-Types.html#gsize">gsize</a> *bytes_written,
                                                         <a class="link" href="glib-Error-Reporting.html#GError">GError</a> **error);
<a class="link" href="glib-IO-Channels.html#GIOStatus">GIOStatus</a>           <a class="link" href="glib-IO-Channels.html#g-io-channel-write-unichar">g_io_channel_write_unichar</a>          (<a class="link" href="glib-IO-Channels.html#GIOChannel">GIOChannel</a> *channel,
                                                         <a class="link" href="glib-Unicode-Manipulation.html#gunichar">gunichar</a> thechar,
                                                         <a class="link" href="glib-Error-Reporting.html#GError">GError</a> **error);
<a class="link" href="glib-IO-Channels.html#GIOStatus">GIOStatus</a>           <a class="link" href="glib-IO-Channels.html#g-io-channel-flush">g_io_channel_flush</a>                  (<a class="link" href="glib-IO-Channels.html#GIOChannel">GIOChannel</a> *channel,
                                                         <a class="link" href="glib-Error-Reporting.html#GError">GError</a> **error);
<a class="link" href="glib-IO-Channels.html#GIOStatus">GIOStatus</a>           <a class="link" href="glib-IO-Channels.html#g-io-channel-seek-position">g_io_channel_seek_position</a>          (<a class="link" href="glib-IO-Channels.html#GIOChannel">GIOChannel</a> *channel,
                                                         <a class="link" href="glib-Basic-Types.html#gint64">gint64</a> offset,
                                                         <a class="link" href="glib-IO-Channels.html#GSeekType">GSeekType</a> type,
                                                         <a class="link" href="glib-Error-Reporting.html#GError">GError</a> **error);
enum                <a class="link" href="glib-IO-Channels.html#GSeekType">GSeekType</a>;
<a class="link" href="glib-IO-Channels.html#GIOStatus">GIOStatus</a>           <a class="link" href="glib-IO-Channels.html#g-io-channel-shutdown">g_io_channel_shutdown</a>               (<a class="link" href="glib-IO-Channels.html#GIOChannel">GIOChannel</a> *channel,
                                                         <a class="link" href="glib-Basic-Types.html#gboolean">gboolean</a> flush,
                                                         <a class="link" href="glib-Error-Reporting.html#GError">GError</a> **err);

enum                <a class="link" href="glib-IO-Channels.html#GIOStatus">GIOStatus</a>;
enum                <a class="link" href="glib-IO-Channels.html#GIOChannelError">GIOChannelError</a>;
#define             <a class="link" href="glib-IO-Channels.html#G-IO-CHANNEL-ERROR:CAPS">G_IO_CHANNEL_ERROR</a>
<a class="link" href="glib-IO-Channels.html#GIOChannelError">GIOChannelError</a>     <a class="link" href="glib-IO-Channels.html#g-io-channel-error-from-errno">g_io_channel_error_from_errno</a>       (<a class="link" href="glib-Basic-Types.html#gint">gint</a> en);

<a class="link" href="glib-IO-Channels.html#GIOChannel">GIOChannel</a>*         <a class="link" href="glib-IO-Channels.html#g-io-channel-ref">g_io_channel_ref</a>                    (<a class="link" href="glib-IO-Channels.html#GIOChannel">GIOChannel</a> *channel);
void                <a class="link" href="glib-IO-Channels.html#g-io-channel-unref">g_io_channel_unref</a>                  (<a class="link" href="glib-IO-Channels.html#GIOChannel">GIOChannel</a> *channel);

<a class="link" href="glib-The-Main-Event-Loop.html#GSource">GSource</a>*            <a class="link" href="glib-IO-Channels.html#g-io-create-watch">g_io_create_watch</a>                   (<a class="link" href="glib-IO-Channels.html#GIOChannel">GIOChannel</a> *channel,
                                                         <a class="link" href="glib-IO-Channels.html#GIOCondition">GIOCondition</a> condition);
<a class="link" href="glib-Basic-Types.html#guint">guint</a>               <a class="link" href="glib-IO-Channels.html#g-io-add-watch">g_io_add_watch</a>                      (<a class="link" href="glib-IO-Channels.html#GIOChannel">GIOChannel</a> *channel,
                                                         <a class="link" href="glib-IO-Channels.html#GIOCondition">GIOCondition</a> condition,
                                                         <a class="link" href="glib-IO-Channels.html#GIOFunc">GIOFunc</a> func,
                                                         <a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> user_data);
<a class="link" href="glib-Basic-Types.html#guint">guint</a>               <a class="link" href="glib-IO-Channels.html#g-io-add-watch-full">g_io_add_watch_full</a>                 (<a class="link" href="glib-IO-Channels.html#GIOChannel">GIOChannel</a> *channel,
                                                         <a class="link" href="glib-Basic-Types.html#gint">gint</a> priority,
                                                         <a class="link" href="glib-IO-Channels.html#GIOCondition">GIOCondition</a> condition,
                                                         <a class="link" href="glib-IO-Channels.html#GIOFunc">GIOFunc</a> func,
                                                         <a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> user_data,
                                                         <a class="link" href="glib-Datasets.html#GDestroyNotify">GDestroyNotify</a> notify);
enum                <a class="link" href="glib-IO-Channels.html#GIOCondition">GIOCondition</a>;
<a class="link" href="glib-Basic-Types.html#gboolean">gboolean</a>            (<a class="link" href="glib-IO-Channels.html#GIOFunc">*GIOFunc</a>)                          (<a class="link" href="glib-IO-Channels.html#GIOChannel">GIOChannel</a> *source,
                                                         <a class="link" href="glib-IO-Channels.html#GIOCondition">GIOCondition</a> condition,
                                                         <a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> data);

                    <a class="link" href="glib-IO-Channels.html#GIOFuncs">GIOFuncs</a>;

<a class="link" href="glib-Basic-Types.html#gsize">gsize</a>               <a class="link" href="glib-IO-Channels.html#g-io-channel-get-buffer-size">g_io_channel_get_buffer_size</a>        (<a class="link" href="glib-IO-Channels.html#GIOChannel">GIOChannel</a> *channel);
void                <a class="link" href="glib-IO-Channels.html#g-io-channel-set-buffer-size">g_io_channel_set_buffer_size</a>        (<a class="link" href="glib-IO-Channels.html#GIOChannel">GIOChannel</a> *channel,
                                                         <a class="link" href="glib-Basic-Types.html#gsize">gsize</a> size);
<a class="link" href="glib-IO-Channels.html#GIOCondition">GIOCondition</a>        <a class="link" href="glib-IO-Channels.html#g-io-channel-get-buffer-condition">g_io_channel_get_buffer_condition</a>   (<a class="link" href="glib-IO-Channels.html#GIOChannel">GIOChannel</a> *channel);
<a class="link" href="glib-IO-Channels.html#GIOFlags">GIOFlags</a>            <a class="link" href="glib-IO-Channels.html#g-io-channel-get-flags">g_io_channel_get_flags</a>              (<a class="link" href="glib-IO-Channels.html#GIOChannel">GIOChannel</a> *channel);
<a class="link" href="glib-IO-Channels.html#GIOStatus">GIOStatus</a>           <a class="link" href="glib-IO-Channels.html#g-io-channel-set-flags">g_io_channel_set_flags</a>              (<a class="link" href="glib-IO-Channels.html#GIOChannel">GIOChannel</a> *channel,
                                                         <a class="link" href="glib-IO-Channels.html#GIOFlags">GIOFlags</a> flags,
                                                         <a class="link" href="glib-Error-Reporting.html#GError">GError</a> **error);
enum                <a class="link" href="glib-IO-Channels.html#GIOFlags">GIOFlags</a>;
const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a>*        <a class="link" href="glib-IO-Channels.html#g-io-channel-get-line-term">g_io_channel_get_line_term</a>          (<a class="link" href="glib-IO-Channels.html#GIOChannel">GIOChannel</a> *channel,
                                                         <a class="link" href="glib-Basic-Types.html#gint">gint</a> *length);
void                <a class="link" href="glib-IO-Channels.html#g-io-channel-set-line-term">g_io_channel_set_line_term</a>          (<a class="link" href="glib-IO-Channels.html#GIOChannel">GIOChannel</a> *channel,
                                                         const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *line_term,
                                                         <a class="link" href="glib-Basic-Types.html#gint">gint</a> length);
<a class="link" href="glib-Basic-Types.html#gboolean">gboolean</a>            <a class="link" href="glib-IO-Channels.html#g-io-channel-get-buffered">g_io_channel_get_buffered</a>           (<a class="link" href="glib-IO-Channels.html#GIOChannel">GIOChannel</a> *channel);
void                <a class="link" href="glib-IO-Channels.html#g-io-channel-set-buffered">g_io_channel_set_buffered</a>           (<a class="link" href="glib-IO-Channels.html#GIOChannel">GIOChannel</a> *channel,
                                                         <a class="link" href="glib-Basic-Types.html#gboolean">gboolean</a> buffered);
const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a>*        <a class="link" href="glib-IO-Channels.html#g-io-channel-get-encoding">g_io_channel_get_encoding</a>           (<a class="link" href="glib-IO-Channels.html#GIOChannel">GIOChannel</a> *channel);
<a class="link" href="glib-IO-Channels.html#GIOStatus">GIOStatus</a>           <a class="link" href="glib-IO-Channels.html#g-io-channel-set-encoding">g_io_channel_set_encoding</a>           (<a class="link" href="glib-IO-Channels.html#GIOChannel">GIOChannel</a> *channel,
                                                         const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *encoding,
                                                         <a class="link" href="glib-Error-Reporting.html#GError">GError</a> **error);
<a class="link" href="glib-Basic-Types.html#gboolean">gboolean</a>            <a class="link" href="glib-IO-Channels.html#g-io-channel-get-close-on-unref">g_io_channel_get_close_on_unref</a>     (<a class="link" href="glib-IO-Channels.html#GIOChannel">GIOChannel</a> *channel);
void                <a class="link" href="glib-IO-Channels.html#g-io-channel-set-close-on-unref">g_io_channel_set_close_on_unref</a>     (<a class="link" href="glib-IO-Channels.html#GIOChannel">GIOChannel</a> *channel,
                                                         <a class="link" href="glib-Basic-Types.html#gboolean">gboolean</a> do_close);


<a class="link" href="glib-IO-Channels.html#GIOError">GIOError</a>            <a class="link" href="glib-IO-Channels.html#g-io-channel-read">g_io_channel_read</a>                   (<a class="link" href="glib-IO-Channels.html#GIOChannel">GIOChannel</a> *channel,
                                                         <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *buf,
                                                         <a class="link" href="glib-Basic-Types.html#gsize">gsize</a> count,
                                                         <a class="link" href="glib-Basic-Types.html#gsize">gsize</a> *bytes_read);
enum                <a class="link" href="glib-IO-Channels.html#GIOError">GIOError</a>;
<a class="link" href="glib-IO-Channels.html#GIOError">GIOError</a>            <a class="link" href="glib-IO-Channels.html#g-io-channel-write">g_io_channel_write</a>                  (<a class="link" href="glib-IO-Channels.html#GIOChannel">GIOChannel</a> *channel,
                                                         const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *buf,
                                                         <a class="link" href="glib-Basic-Types.html#gsize">gsize</a> count,
                                                         <a class="link" href="glib-Basic-Types.html#gsize">gsize</a> *bytes_written);
<a class="link" href="glib-IO-Channels.html#GIOError">GIOError</a>            <a class="link" href="glib-IO-Channels.html#g-io-channel-seek">g_io_channel_seek</a>                   (<a class="link" href="glib-IO-Channels.html#GIOChannel">GIOChannel</a> *channel,
                                                         <a class="link" href="glib-Basic-Types.html#gint64">gint64</a> offset,
                                                         <a class="link" href="glib-IO-Channels.html#GSeekType">GSeekType</a> type);
void                <a class="link" href="glib-IO-Channels.html#g-io-channel-close">g_io_channel_close</a>                  (<a class="link" href="glib-IO-Channels.html#GIOChannel">GIOChannel</a> *channel);

</pre>
</div>
<div class="refsect1" lang="en">
<a name="id2985449"></a><h2>Description</h2>
<p>
The <a class="link" href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a> data type aims to provide a portable method for using file
descriptors, pipes, and sockets, and integrating them into the
<a class="link" href="glib-The-Main-Event-Loop.html" title="The Main Event Loop">main event loop</a>.
Currently full support is available on UNIX platforms, support for
Windows is only partially complete.
</p>
<p>
To create a new <a class="link" href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a> on UNIX systems use <a class="link" href="glib-IO-Channels.html#g-io-channel-unix-new"><code class="function">g_io_channel_unix_new()</code></a>.
This works for plain file descriptors, pipes and sockets.
Alternatively, a channel can be created for a file in a system independent
manner using <a class="link" href="glib-IO-Channels.html#g-io-channel-new-file"><code class="function">g_io_channel_new_file()</code></a>.
</p>
<p>
Once a <a class="link" href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a> has been created, it can be used in a generic manner
with the functions <a class="link" href="glib-IO-Channels.html#g-io-channel-read-chars"><code class="function">g_io_channel_read_chars()</code></a>, <a class="link" href="glib-IO-Channels.html#g-io-channel-write-chars"><code class="function">g_io_channel_write_chars()</code></a>,
<a class="link" href="glib-IO-Channels.html#g-io-channel-seek-position"><code class="function">g_io_channel_seek_position()</code></a>, and <a class="link" href="glib-IO-Channels.html#g-io-channel-shutdown"><code class="function">g_io_channel_shutdown()</code></a>.
</p>
<p>
To add a <a class="link" href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a> to the 
<a class="link" href="glib-The-Main-Event-Loop.html" title="The Main Event Loop">main event loop</a>
use <a class="link" href="glib-IO-Channels.html#g-io-add-watch"><code class="function">g_io_add_watch()</code></a> or <a class="link" href="glib-IO-Channels.html#g-io-add-watch-full"><code class="function">g_io_add_watch_full()</code></a>. Here you specify which events
you are interested in on the <a class="link" href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a>, and provide a function to be
called whenever these events occur.
</p>
<p>
<a class="link" href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a> instances are created with an initial reference count of 1.
<a class="link" href="glib-IO-Channels.html#g-io-channel-ref"><code class="function">g_io_channel_ref()</code></a> and <a class="link" href="glib-IO-Channels.html#g-io-channel-unref"><code class="function">g_io_channel_unref()</code></a> can be used to increment or
decrement the reference count respectively. When the reference count falls
to 0, the <a class="link" href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a> is freed. (Though it isn't closed automatically,
unless it was created using <code class="function">g_io_channel_new_from_file()</code>.)
Using <a class="link" href="glib-IO-Channels.html#g-io-add-watch"><code class="function">g_io_add_watch()</code></a> or <a class="link" href="glib-IO-Channels.html#g-io-add-watch-full"><code class="function">g_io_add_watch_full()</code></a> increments a channel's
reference count.
</p>
<p>
The new functions <a class="link" href="glib-IO-Channels.html#g-io-channel-read-chars"><code class="function">g_io_channel_read_chars()</code></a>, <a class="link" href="glib-IO-Channels.html#g-io-channel-read-line"><code class="function">g_io_channel_read_line()</code></a>,
<a class="link" href="glib-IO-Channels.html#g-io-channel-read-line-string"><code class="function">g_io_channel_read_line_string()</code></a>, <a class="link" href="glib-IO-Channels.html#g-io-channel-read-to-end"><code class="function">g_io_channel_read_to_end()</code></a>,
<a class="link" href="glib-IO-Channels.html#g-io-channel-write-chars"><code class="function">g_io_channel_write_chars()</code></a>, <a class="link" href="glib-IO-Channels.html#g-io-channel-seek-position"><code class="function">g_io_channel_seek_position()</code></a>,
and <a class="link" href="glib-IO-Channels.html#g-io-channel-flush"><code class="function">g_io_channel_flush()</code></a> should not be mixed with the
deprecated functions <a class="link" href="glib-IO-Channels.html#g-io-channel-read"><code class="function">g_io_channel_read()</code></a>, <a class="link" href="glib-IO-Channels.html#g-io-channel-write"><code class="function">g_io_channel_write()</code></a>,
and <a class="link" href="glib-IO-Channels.html#g-io-channel-seek"><code class="function">g_io_channel_seek()</code></a> on the same channel.
</p>
</div>
<div class="refsect1" lang="en">
<a name="id2985818"></a><h2>Details</h2>
<div class="refsect2" lang="en">
<a name="id2985828"></a><h3>
<a name="GIOChannel"></a>GIOChannel</h3>
<a class="indexterm" name="id2985840"></a><pre class="programlisting">typedef struct {
} GIOChannel;
</pre>
<p>
A data structure representing an IO Channel. The fields should be considered
private and should only be accessed with the following functions.
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2985858"></a><h3>
<a name="g-io-channel-unix-new"></a>g_io_channel_unix_new ()</h3>
<a class="indexterm" name="id2985871"></a><pre class="programlisting"><a class="link" href="glib-IO-Channels.html#GIOChannel">GIOChannel</a>*         g_io_channel_unix_new               (int fd);</pre>
<p>
Creates a new <a class="link" href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a> given a file descriptor.
On UNIX systems this works for plain files, pipes, and sockets.
</p>
<p>
The returned <a class="link" href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a> has a reference count of 1.
</p>
<p>
The default encoding for <a class="link" href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a> is UTF-8. If your application
is reading output from a command using via pipe, you may need to
set the encoding to the encoding of the current locale (see
<a class="link" href="glib-Character-Set-Conversion.html#g-get-charset"><code class="function">g_get_charset()</code></a>) with the <a class="link" href="glib-IO-Channels.html#g-io-channel-set-encoding"><code class="function">g_io_channel_set_encoding()</code></a> function.
</p>
<p>
If you want to read raw binary data without interpretation, then
call the <a class="link" href="glib-IO-Channels.html#g-io-channel-set-encoding"><code class="function">g_io_channel_set_encoding()</code></a> function with <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> for the
encoding argument.
</p>
<p>
This function is available in GLib on Windows, too, but you should
avoid using it on Windows. The domain of file descriptors and sockets
overlap. There is no way for GLib to know which one you mean in case
the argument you pass to this function happens to be both a valid file
descriptor and socket. If that happens a warning is issued, and GLib
assumes that it is the file descriptor you mean.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>fd</code></em>&#160;:</span></p></td>
<td>a file descriptor.
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
<td>a new <a class="link" href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a>.


</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2986031"></a><h3>
<a name="g-io-channel-unix-get-fd"></a>g_io_channel_unix_get_fd ()</h3>
<a class="indexterm" name="id2986044"></a><pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gint">gint</a>                g_io_channel_unix_get_fd            (<a class="link" href="glib-IO-Channels.html#GIOChannel">GIOChannel</a> *channel);</pre>
<p>
Returns the file descriptor of the <a class="link" href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a>.
</p>
<p>
On Windows this function returns the file descriptor or socket of the <a class="link" href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>channel</code></em>&#160;:</span></p></td>
<td>a <a class="link" href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a>, created with <a class="link" href="glib-IO-Channels.html#g-io-channel-unix-new"><code class="function">g_io_channel_unix_new()</code></a>.
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
<td>the file descriptor of the <a class="link" href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a>.


</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2986149"></a><h3>
<a name="g-io-channel-win32-new-fd"></a>g_io_channel_win32_new_fd ()</h3>
<a class="indexterm" name="id2986163"></a><pre class="programlisting"><a class="link" href="glib-IO-Channels.html#GIOChannel">GIOChannel</a>*         g_io_channel_win32_new_fd           (<a class="link" href="glib-Basic-Types.html#gint">gint</a> fd);</pre>
<p>
Creates a new <a class="link" href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a> given a file descriptor on Windows. 
This works for file descriptors from the C runtime.
</p>
<p>
This function works for file descriptors as returned by the <code class="function">open()</code>,
<code class="function">creat()</code>, <code class="function">pipe()</code> and <code class="function">fileno()</code> calls in the Microsoft C runtime. In
order to meaningfully use this function your code should use the same
C runtime as GLib uses, which is msvcrt.dll. Note that in current
Microsoft compilers it is near impossible to convince it to build code
that would use msvcrt.dll. The last Microsoft compiler version that
supported using msvcrt.dll as the C runtime was version 6. The GNU
compiler and toolchain for Windows, also known as Mingw, fully
supports msvcrt.dll.
</p>
<p>
If you have created a <a class="link" href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a> for a file descriptor and started
watching (polling) it, you shouldn't call <code class="function">read()</code> on the file
descriptor. This is because adding polling for a file descriptor is
implemented in GLib on Windows by starting a thread that sits blocked
in a <code class="function">read()</code> from the file descriptor most of the time. All reads from
the file descriptor should be done by this internal GLib thread. Your
code should call only <a class="link" href="glib-IO-Channels.html#g-io-channel-read"><code class="function">g_io_channel_read()</code></a>.
</p>
<p>
This function is available only in GLib on Windows.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>fd</code></em>&#160;:</span></p></td>
<td>a C library file descriptor.
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
<td>a new <a class="link" href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a>.


</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2983886"></a><h3>
<a name="g-io-channel-win32-new-socket"></a>g_io_channel_win32_new_socket ()</h3>
<a class="indexterm" name="id2983900"></a><pre class="programlisting"><a class="link" href="glib-IO-Channels.html#GIOChannel">GIOChannel</a>*         g_io_channel_win32_new_socket       (<a class="link" href="glib-Basic-Types.html#gint">gint</a> socket);</pre>
<p>
Creates a new <a class="link" href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a> given a socket on Windows.
</p>
<p>
This function works for sockets created by Winsock. 
It's available only in GLib on Windows.
</p>
<p>
Polling a <a class="link" href="glib-The-Main-Event-Loop.html#GSource"><span class="type">GSource</span></a> created to watch a channel for a socket 
puts the socket in non-blocking mode. This is a side-effect 
of the implementation and unavoidable.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>socket</code></em>&#160;:</span></p></td>
<td>a Winsock socket
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
<td>a new <a class="link" href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a>


</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2986592"></a><h3>
<a name="g-io-channel-win32-new-messages"></a>g_io_channel_win32_new_messages ()</h3>
<a class="indexterm" name="id2986606"></a><pre class="programlisting"><a class="link" href="glib-IO-Channels.html#GIOChannel">GIOChannel</a>*         g_io_channel_win32_new_messages     (<a class="link" href="glib-Basic-Types.html#guint">guint</a> hwnd);</pre>
<p>
Creates a new <a class="link" href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a> given a window handle on Windows.
</p>
<p>
This function creates a <a class="link" href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a> that can be used to poll for
Windows messages for the window in question.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>hwnd</code></em>&#160;:</span></p></td>
<td>a window handle.
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
<td>a new <a class="link" href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a>.


</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2986692"></a><h3>
<a name="g-io-channel-init"></a>g_io_channel_init ()</h3>
<a class="indexterm" name="id2986706"></a><pre class="programlisting">void                g_io_channel_init                   (<a class="link" href="glib-IO-Channels.html#GIOChannel">GIOChannel</a> *channel);</pre>
<p>
Initializes a <a class="link" href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a> struct. This is called by each of the 
above functions when creating a <a class="link" href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a>, and so is not often 
needed by the application programmer (unless you are creating a 
new type of <a class="link" href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a>).
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><em class="parameter"><code>channel</code></em>&#160;:</span></p></td>
<td>a <a class="link" href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a>


</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2986786"></a><h3>
<a name="g-io-channel-new-file"></a>g_io_channel_new_file ()</h3>
<a class="indexterm" name="id2986799"></a><pre class="programlisting"><a class="link" href="glib-IO-Channels.html#GIOChannel">GIOChannel</a>*         g_io_channel_new_file               (const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *filename,
                                                         const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *mode,
                                                         <a class="link" href="glib-Error-Reporting.html#GError">GError</a> **error);</pre>
<p>
Open a file <em class="parameter"><code>filename</code></em> as a <a class="link" href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a> using mode <em class="parameter"><code>mode</code></em>. This
channel will be closed when the last reference to it is dropped,
so there is no need to call <a class="link" href="glib-IO-Channels.html#g-io-channel-close"><code class="function">g_io_channel_close()</code></a> (though doing
so will not cause problems, as long as no attempt is made to
access the channel after it is closed).</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>filename</code></em>&#160;:</span></p></td>
<td> A string containing the name of a file
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>mode</code></em>&#160;:</span></p></td>
<td> One of "r", "w", "a", "r+", "w+", "a+". These have
       the same meaning as in <code class="function">fopen()</code>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>error</code></em>&#160;:</span></p></td>
<td> A location to return an error of type <a class="link" href="glib-File-Utilities.html#G-FILE-ERROR:CAPS"><code class="literal">G_FILE_ERROR</code></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
<td> A <a class="link" href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a> on success, <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> on failure.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2986981"></a><h3>
<a name="g-io-channel-read-chars"></a>g_io_channel_read_chars ()</h3>
<a class="indexterm" name="id2986995"></a><pre class="programlisting"><a class="link" href="glib-IO-Channels.html#GIOStatus">GIOStatus</a>           g_io_channel_read_chars             (<a class="link" href="glib-IO-Channels.html#GIOChannel">GIOChannel</a> *channel,
                                                         <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *buf,
                                                         <a class="link" href="glib-Basic-Types.html#gsize">gsize</a> count,
                                                         <a class="link" href="glib-Basic-Types.html#gsize">gsize</a> *bytes_read,
                                                         <a class="link" href="glib-Error-Reporting.html#GError">GError</a> **error);</pre>
<p>
Replacement for <a class="link" href="glib-IO-Channels.html#g-io-channel-read"><code class="function">g_io_channel_read()</code></a> with the new API.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>channel</code></em>&#160;:</span></p></td>
<td> a <a class="link" href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>buf</code></em>&#160;:</span></p></td>
<td> a buffer to read data into
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>count</code></em>&#160;:</span></p></td>
<td> the size of the buffer. Note that the buffer may
        not be complelely filled even if there is data
        in the buffer if the remaining data is not a
        complete character.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>bytes_read</code></em>&#160;:</span></p></td>
<td> The number of bytes read. This may be zero even on
             success if count &lt; 6 and the channel's encoding is non-<a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.
             This indicates that the next UTF-8 character is too wide for
             the buffer.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>error</code></em>&#160;:</span></p></td>
<td> a location to return an error of type <a class="link" href="glib-Character-Set-Conversion.html#GConvertError"><span class="type">GConvertError</span></a>
        or <a class="link" href="glib-IO-Channels.html#GIOChannelError"><span class="type">GIOChannelError</span></a>.
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
<td> the status of the operation.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2987196"></a><h3>
<a name="g-io-channel-read-unichar"></a>g_io_channel_read_unichar ()</h3>
<a class="indexterm" name="id2987210"></a><pre class="programlisting"><a class="link" href="glib-IO-Channels.html#GIOStatus">GIOStatus</a>           g_io_channel_read_unichar           (<a class="link" href="glib-IO-Channels.html#GIOChannel">GIOChannel</a> *channel,
                                                         <a class="link" href="glib-Unicode-Manipulation.html#gunichar">gunichar</a> *thechar,
                                                         <a class="link" href="glib-Error-Reporting.html#GError">GError</a> **error);</pre>
<p>
Reads a Unicode character from <em class="parameter"><code>channel</code></em>.
This function cannot be called on a channel with <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> encoding.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>channel</code></em>&#160;:</span></p></td>
<td> a <a class="link" href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>thechar</code></em>&#160;:</span></p></td>
<td> a location to return a character
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>error</code></em>&#160;:</span></p></td>
<td> a location to return an error of type <a class="link" href="glib-Character-Set-Conversion.html#GConvertError"><span class="type">GConvertError</span></a>
        or <a class="link" href="glib-IO-Channels.html#GIOChannelError"><span class="type">GIOChannelError</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
<td> a <a class="link" href="glib-IO-Channels.html#GIOStatus"><span class="type">GIOStatus</span></a>
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2987363"></a><h3>
<a name="g-io-channel-read-line"></a>g_io_channel_read_line ()</h3>
<a class="indexterm" name="id2987376"></a><pre class="programlisting"><a class="link" href="glib-IO-Channels.html#GIOStatus">GIOStatus</a>           g_io_channel_read_line              (<a class="link" href="glib-IO-Channels.html#GIOChannel">GIOChannel</a> *channel,
                                                         <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> **str_return,
                                                         <a class="link" href="glib-Basic-Types.html#gsize">gsize</a> *length,
                                                         <a class="link" href="glib-Basic-Types.html#gsize">gsize</a> *terminator_pos,
                                                         <a class="link" href="glib-Error-Reporting.html#GError">GError</a> **error);</pre>
<p>
Reads a line, including the terminating character(s),
from a <a class="link" href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a> into a newly-allocated string.
<em class="parameter"><code>str_return</code></em> will contain allocated memory if the return
is <a class="link" href="glib-IO-Channels.html#G-IO-STATUS-NORMAL:CAPS"><code class="literal">G_IO_STATUS_NORMAL</code></a>.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>channel</code></em>&#160;:</span></p></td>
<td> a <a class="link" href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>str_return</code></em>&#160;:</span></p></td>
<td> The line read from the <a class="link" href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a>, including the
             line terminator. This data should be freed with <a class="link" href="glib-Memory-Allocation.html#g-free"><code class="function">g_free()</code></a>
             when no longer needed. This is a nul-terminated string. 
             If a <em class="parameter"><code>length</code></em> of zero is returned, this will be <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> instead.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>length</code></em>&#160;:</span></p></td>
<td> location to store length of the read data, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>terminator_pos</code></em>&#160;:</span></p></td>
<td> location to store position of line terminator, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>error</code></em>&#160;:</span></p></td>
<td> A location to return an error of type <a class="link" href="glib-Character-Set-Conversion.html#GConvertError"><span class="type">GConvertError</span></a>
        or <a class="link" href="glib-IO-Channels.html#GIOChannelError"><span class="type">GIOChannelError</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
<td> the status of the operation.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2987635"></a><h3>
<a name="g-io-channel-read-line-string"></a>g_io_channel_read_line_string ()</h3>
<a class="indexterm" name="id2987648"></a><pre class="programlisting"><a class="link" href="glib-IO-Channels.html#GIOStatus">GIOStatus</a>           g_io_channel_read_line_string       (<a class="link" href="glib-IO-Channels.html#GIOChannel">GIOChannel</a> *channel,
                                                         <a class="link" href="glib-Strings.html#GString">GString</a> *buffer,
                                                         <a class="link" href="glib-Basic-Types.html#gsize">gsize</a> *terminator_pos,
                                                         <a class="link" href="glib-Error-Reporting.html#GError">GError</a> **error);</pre>
<p>
Reads a line from a <a class="link" href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a>, using a <a class="link" href="glib-Strings.html#GString"><span class="type">GString</span></a> as a buffer.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>channel</code></em>&#160;:</span></p></td>
<td> a <a class="link" href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>buffer</code></em>&#160;:</span></p></td>
<td> a <a class="link" href="glib-Strings.html#GString"><span class="type">GString</span></a> into which the line will be written.
         If <em class="parameter"><code>buffer</code></em> already contains data, the old data will
         be overwritten.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>terminator_pos</code></em>&#160;:</span></p></td>
<td> location to store position of line terminator, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>error</code></em>&#160;:</span></p></td>
<td> a location to store an error of type <a class="link" href="glib-Character-Set-Conversion.html#GConvertError"><span class="type">GConvertError</span></a>
        or <a class="link" href="glib-IO-Channels.html#GIOChannelError"><span class="type">GIOChannelError</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
<td> the status of the operation.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2987841"></a><h3>
<a name="g-io-channel-read-to-end"></a>g_io_channel_read_to_end ()</h3>
<a class="indexterm" name="id2987855"></a><pre class="programlisting"><a class="link" href="glib-IO-Channels.html#GIOStatus">GIOStatus</a>           g_io_channel_read_to_end            (<a class="link" href="glib-IO-Channels.html#GIOChannel">GIOChannel</a> *channel,
                                                         <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> **str_return,
                                                         <a class="link" href="glib-Basic-Types.html#gsize">gsize</a> *length,
                                                         <a class="link" href="glib-Error-Reporting.html#GError">GError</a> **error);</pre>
<p>
Reads all the remaining data from the file.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>channel</code></em>&#160;:</span></p></td>
<td> a <a class="link" href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>str_return</code></em>&#160;:</span></p></td>
<td> Location to store a pointer to a string holding
             the remaining data in the <a class="link" href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a>. This data should
             be freed with <a class="link" href="glib-Memory-Allocation.html#g-free"><code class="function">g_free()</code></a> when no longer needed. This
             data is terminated by an extra nul character, but there 
             may be other nuls in the intervening data.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>length</code></em>&#160;:</span></p></td>
<td> location to store length of the data
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>error</code></em>&#160;:</span></p></td>
<td> location to return an error of type <a class="link" href="glib-Character-Set-Conversion.html#GConvertError"><span class="type">GConvertError</span></a>
        or <a class="link" href="glib-IO-Channels.html#GIOChannelError"><span class="type">GIOChannelError</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
<td> <a class="link" href="glib-IO-Channels.html#G-IO-STATUS-NORMAL:CAPS"><code class="literal">G_IO_STATUS_NORMAL</code></a> on success. 
    This function never returns <a class="link" href="glib-IO-Channels.html#G-IO-STATUS-EOF:CAPS"><code class="literal">G_IO_STATUS_EOF</code></a>.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2988052"></a><h3>
<a name="g-io-channel-write-chars"></a>g_io_channel_write_chars ()</h3>
<a class="indexterm" name="id2988065"></a><pre class="programlisting"><a class="link" href="glib-IO-Channels.html#GIOStatus">GIOStatus</a>           g_io_channel_write_chars            (<a class="link" href="glib-IO-Channels.html#GIOChannel">GIOChannel</a> *channel,
                                                         const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *buf,
                                                         <a class="link" href="glib-Basic-Types.html#gssize">gssize</a> count,
                                                         <a class="link" href="glib-Basic-Types.html#gsize">gsize</a> *bytes_written,
                                                         <a class="link" href="glib-Error-Reporting.html#GError">GError</a> **error);</pre>
<p>
Replacement for <a class="link" href="glib-IO-Channels.html#g-io-channel-write"><code class="function">g_io_channel_write()</code></a> with the new API.
</p>
<p>
On seekable channels with encodings other than <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> or UTF-8, generic
mixing of reading and writing is not allowed. A call to <a class="link" href="glib-IO-Channels.html#g-io-channel-write-chars"><code class="function">g_io_channel_write_chars()</code></a>
may only be made on a channel from which data has been read in the
cases described in the documentation for <a class="link" href="glib-IO-Channels.html#g-io-channel-set-encoding"><code class="function">g_io_channel_set_encoding()</code></a>.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>channel</code></em>&#160;:</span></p></td>
<td> a <a class="link" href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>buf</code></em>&#160;:</span></p></td>
<td> a buffer to write data from
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>count</code></em>&#160;:</span></p></td>
<td> the size of the buffer. If -1, the buffer
        is taken to be a nul-terminated string.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>bytes_written</code></em>&#160;:</span></p></td>
<td> The number of bytes written. This can be nonzero
                even if the return value is not <a class="link" href="glib-IO-Channels.html#G-IO-STATUS-NORMAL:CAPS"><code class="literal">G_IO_STATUS_NORMAL</code></a>.
                If the return value is <a class="link" href="glib-IO-Channels.html#G-IO-STATUS-NORMAL:CAPS"><code class="literal">G_IO_STATUS_NORMAL</code></a> and the
                channel is blocking, this will always be equal
                to <em class="parameter"><code>count</code></em> if <em class="parameter"><code>count</code></em> &gt;= 0.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>error</code></em>&#160;:</span></p></td>
<td> a location to return an error of type <a class="link" href="glib-Character-Set-Conversion.html#GConvertError"><span class="type">GConvertError</span></a>
        or <a class="link" href="glib-IO-Channels.html#GIOChannelError"><span class="type">GIOChannelError</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
<td> the status of the operation.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2988327"></a><h3>
<a name="g-io-channel-write-unichar"></a>g_io_channel_write_unichar ()</h3>
<a class="indexterm" name="id2988340"></a><pre class="programlisting"><a class="link" href="glib-IO-Channels.html#GIOStatus">GIOStatus</a>           g_io_channel_write_unichar          (<a class="link" href="glib-IO-Channels.html#GIOChannel">GIOChannel</a> *channel,
                                                         <a class="link" href="glib-Unicode-Manipulation.html#gunichar">gunichar</a> thechar,
                                                         <a class="link" href="glib-Error-Reporting.html#GError">GError</a> **error);</pre>
<p>
Writes a Unicode character to <em class="parameter"><code>channel</code></em>.
This function cannot be called on a channel with <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> encoding.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>channel</code></em>&#160;:</span></p></td>
<td> a <a class="link" href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>thechar</code></em>&#160;:</span></p></td>
<td> a character
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>error</code></em>&#160;:</span></p></td>
<td> location to return an error of type <a class="link" href="glib-Character-Set-Conversion.html#GConvertError"><span class="type">GConvertError</span></a>
        or <a class="link" href="glib-IO-Channels.html#GIOChannelError"><span class="type">GIOChannelError</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
<td> a <a class="link" href="glib-IO-Channels.html#GIOStatus"><span class="type">GIOStatus</span></a>
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2988493"></a><h3>
<a name="g-io-channel-flush"></a>g_io_channel_flush ()</h3>
<a class="indexterm" name="id2988506"></a><pre class="programlisting"><a class="link" href="glib-IO-Channels.html#GIOStatus">GIOStatus</a>           g_io_channel_flush                  (<a class="link" href="glib-IO-Channels.html#GIOChannel">GIOChannel</a> *channel,
                                                         <a class="link" href="glib-Error-Reporting.html#GError">GError</a> **error);</pre>
<p>
Flushes the write buffer for the GIOChannel.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>channel</code></em>&#160;:</span></p></td>
<td> a <a class="link" href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>error</code></em>&#160;:</span></p></td>
<td> location to store an error of type <a class="link" href="glib-IO-Channels.html#GIOChannelError"><span class="type">GIOChannelError</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
<td> the status of the operation: One of
  <span class="type">G_IO_CHANNEL_NORMAL</span>, <span class="type">G_IO_CHANNEL_AGAIN</span>, or
  <a class="link" href="glib-IO-Channels.html#G-IO-CHANNEL-ERROR:CAPS"><span class="type">G_IO_CHANNEL_ERROR</span></a>.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2988633"></a><h3>
<a name="g-io-channel-seek-position"></a>g_io_channel_seek_position ()</h3>
<a class="indexterm" name="id2988647"></a><pre class="programlisting"><a class="link" href="glib-IO-Channels.html#GIOStatus">GIOStatus</a>           g_io_channel_seek_position          (<a class="link" href="glib-IO-Channels.html#GIOChannel">GIOChannel</a> *channel,
                                                         <a class="link" href="glib-Basic-Types.html#gint64">gint64</a> offset,
                                                         <a class="link" href="glib-IO-Channels.html#GSeekType">GSeekType</a> type,
                                                         <a class="link" href="glib-Error-Reporting.html#GError">GError</a> **error);</pre>
<p>
Replacement for <a class="link" href="glib-IO-Channels.html#g-io-channel-seek"><code class="function">g_io_channel_seek()</code></a> with the new API.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>channel</code></em>&#160;:</span></p></td>
<td> a <a class="link" href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>offset</code></em>&#160;:</span></p></td>
<td> The offset in bytes from the position specified by <em class="parameter"><code>type</code></em>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>type</code></em>&#160;:</span></p></td>
<td> a <a class="link" href="glib-IO-Channels.html#GSeekType"><span class="type">GSeekType</span></a>. The type <a class="link" href="glib-IO-Channels.html#G-SEEK-CUR:CAPS"><code class="literal">G_SEEK_CUR</code></a> is only allowed in those
                     cases where a call to <a class="link" href="glib-IO-Channels.html#g-io-channel-set-encoding"><code class="function">g_io_channel_set_encoding()</code></a>
                     is allowed. See the documentation for
                     <a class="link" href="glib-IO-Channels.html#g-io-channel-set-encoding"><code class="function">g_io_channel_set_encoding()</code></a> for details.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>error</code></em>&#160;:</span></p></td>
<td> A location to return an error of type <a class="link" href="glib-IO-Channels.html#GIOChannelError"><span class="type">GIOChannelError</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
<td> the status of the operation.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2988850"></a><h3>
<a name="GSeekType"></a>enum GSeekType</h3>
<a class="indexterm" name="id2988862"></a><pre class="programlisting">typedef enum
{
  G_SEEK_CUR,
  G_SEEK_SET,
  G_SEEK_END
} GSeekType;
</pre>
<p>
An enumeration specifying the base position for a <a class="link" href="glib-IO-Channels.html#g-io-channel-seek-position"><code class="function">g_io_channel_seek_position()</code></a>
operation.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><a name="G-SEEK-CUR:CAPS"></a><code class="literal">G_SEEK_CUR</code></span></p></td>
<td>the current position in the file.
</td>
</tr>
<tr>
<td><p><span class="term"><a name="G-SEEK-SET:CAPS"></a><code class="literal">G_SEEK_SET</code></span></p></td>
<td>the start of the file.
</td>
</tr>
<tr>
<td><p><span class="term"><a name="G-SEEK-END:CAPS"></a><code class="literal">G_SEEK_END</code></span></p></td>
<td>the end of the file.

</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2988961"></a><h3>
<a name="g-io-channel-shutdown"></a>g_io_channel_shutdown ()</h3>
<a class="indexterm" name="id2988975"></a><pre class="programlisting"><a class="link" href="glib-IO-Channels.html#GIOStatus">GIOStatus</a>           g_io_channel_shutdown               (<a class="link" href="glib-IO-Channels.html#GIOChannel">GIOChannel</a> *channel,
                                                         <a class="link" href="glib-Basic-Types.html#gboolean">gboolean</a> flush,
                                                         <a class="link" href="glib-Error-Reporting.html#GError">GError</a> **err);</pre>
<p>
Close an IO channel. Any pending data to be written will be
flushed if <em class="parameter"><code>flush</code></em> is <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a>. The channel will not be freed until the
last reference is dropped using <a class="link" href="glib-IO-Channels.html#g-io-channel-unref"><code class="function">g_io_channel_unref()</code></a>.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>channel</code></em>&#160;:</span></p></td>
<td> a <a class="link" href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>flush</code></em>&#160;:</span></p></td>
<td> if <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a>, flush pending
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>err</code></em>&#160;:</span></p></td>
<td> location to store a <a class="link" href="glib-IO-Channels.html#GIOChannelError"><span class="type">GIOChannelError</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
<td> the status of the operation.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2989134"></a><h3>
<a name="GIOStatus"></a>enum GIOStatus</h3>
<a class="indexterm" name="id2989146"></a><pre class="programlisting">typedef enum
{
  G_IO_STATUS_ERROR,
  G_IO_STATUS_NORMAL,
  G_IO_STATUS_EOF,
  G_IO_STATUS_AGAIN
} GIOStatus;
</pre>
<p>
Stati returned by most of the <a class="link" href="glib-IO-Channels.html#GIOFuncs"><span class="type">GIOFuncs</span></a> functions. 
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><a name="G-IO-STATUS-ERROR:CAPS"></a><code class="literal">G_IO_STATUS_ERROR</code></span></p></td>
<td>An error occurred.
</td>
</tr>
<tr>
<td><p><span class="term"><a name="G-IO-STATUS-NORMAL:CAPS"></a><code class="literal">G_IO_STATUS_NORMAL</code></span></p></td>
<td>Success.
</td>
</tr>
<tr>
<td><p><span class="term"><a name="G-IO-STATUS-EOF:CAPS"></a><code class="literal">G_IO_STATUS_EOF</code></span></p></td>
<td>End of file.
</td>
</tr>
<tr>
<td><p><span class="term"><a name="G-IO-STATUS-AGAIN:CAPS"></a><code class="literal">G_IO_STATUS_AGAIN</code></span></p></td>
<td>Resource temporarily unavailable.

</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2989266"></a><h3>
<a name="GIOChannelError"></a>enum GIOChannelError</h3>
<a class="indexterm" name="id2989278"></a><pre class="programlisting">typedef enum
{
  /* Derived from errno */
  G_IO_CHANNEL_ERROR_FBIG,
  G_IO_CHANNEL_ERROR_INVAL,
  G_IO_CHANNEL_ERROR_IO,
  G_IO_CHANNEL_ERROR_ISDIR,
  G_IO_CHANNEL_ERROR_NOSPC,
  G_IO_CHANNEL_ERROR_NXIO,
  G_IO_CHANNEL_ERROR_OVERFLOW,
  G_IO_CHANNEL_ERROR_PIPE,
  /* Other */
  G_IO_CHANNEL_ERROR_FAILED
} GIOChannelError;
</pre>
<p>
Error codes returned by <a class="link" href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a> operations.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><a name="G-IO-CHANNEL-ERROR-FBIG:CAPS"></a><code class="literal">G_IO_CHANNEL_ERROR_FBIG</code></span></p></td>
<td>File too large.
</td>
</tr>
<tr>
<td><p><span class="term"><a name="G-IO-CHANNEL-ERROR-INVAL:CAPS"></a><code class="literal">G_IO_CHANNEL_ERROR_INVAL</code></span></p></td>
<td>Invalid argument.
</td>
</tr>
<tr>
<td><p><span class="term"><a name="G-IO-CHANNEL-ERROR-IO:CAPS"></a><code class="literal">G_IO_CHANNEL_ERROR_IO</code></span></p></td>
<td>IO error.
</td>
</tr>
<tr>
<td><p><span class="term"><a name="G-IO-CHANNEL-ERROR-ISDIR:CAPS"></a><code class="literal">G_IO_CHANNEL_ERROR_ISDIR</code></span></p></td>
<td>File is a directory.
</td>
</tr>
<tr>
<td><p><span class="term"><a name="G-IO-CHANNEL-ERROR-NOSPC:CAPS"></a><code class="literal">G_IO_CHANNEL_ERROR_NOSPC</code></span></p></td>
<td>No space left on device.
</td>
</tr>
<tr>
<td><p><span class="term"><a name="G-IO-CHANNEL-ERROR-NXIO:CAPS"></a><code class="literal">G_IO_CHANNEL_ERROR_NXIO</code></span></p></td>
<td>No such device or address.
</td>
</tr>
<tr>
<td><p><span class="term"><a name="G-IO-CHANNEL-ERROR-OVERFLOW:CAPS"></a><code class="literal">G_IO_CHANNEL_ERROR_OVERFLOW</code></span></p></td>
<td>Value too large for defined datatype.
</td>
</tr>
<tr>
<td><p><span class="term"><a name="G-IO-CHANNEL-ERROR-PIPE:CAPS"></a><code class="literal">G_IO_CHANNEL_ERROR_PIPE</code></span></p></td>
<td>Broken pipe.
</td>
</tr>
<tr>
<td><p><span class="term"><a name="G-IO-CHANNEL-ERROR-FAILED:CAPS"></a><code class="literal">G_IO_CHANNEL_ERROR_FAILED</code></span></p></td>
<td>Some other error.

</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2989518"></a><h3>
<a name="G-IO-CHANNEL-ERROR:CAPS"></a>G_IO_CHANNEL_ERROR</h3>
<a class="indexterm" name="id2989532"></a><pre class="programlisting">#define G_IO_CHANNEL_ERROR g_io_channel_error_quark()
</pre>
<p>
Error domain for <a class="link" href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a> operations. Errors in this domain will
be from the <a class="link" href="glib-IO-Channels.html#GIOChannelError"><span class="type">GIOChannelError</span></a> enumeration. See <a class="link" href="glib-Error-Reporting.html#GError"><span class="type">GError</span></a> for information on
error domains.
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2989573"></a><h3>
<a name="g-io-channel-error-from-errno"></a>g_io_channel_error_from_errno ()</h3>
<a class="indexterm" name="id2989587"></a><pre class="programlisting"><a class="link" href="glib-IO-Channels.html#GIOChannelError">GIOChannelError</a>     g_io_channel_error_from_errno       (<a class="link" href="glib-Basic-Types.html#gint">gint</a> en);</pre>
<p>
Converts an <code class="literal">errno</code> error number to a <a class="link" href="glib-IO-Channels.html#GIOChannelError"><span class="type">GIOChannelError</span></a>.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>en</code></em>&#160;:</span></p></td>
<td> an <code class="literal">errno</code> error number, e.g. <code class="literal">EINVAL</code>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
<td> a <a class="link" href="glib-IO-Channels.html#GIOChannelError"><span class="type">GIOChannelError</span></a> error number, e.g. 
     <a class="link" href="glib-IO-Channels.html#G-IO-CHANNEL-ERROR-INVAL:CAPS"><code class="literal">G_IO_CHANNEL_ERROR_INVAL</code></a>.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2989700"></a><h3>
<a name="g-io-channel-ref"></a>g_io_channel_ref ()</h3>
<a class="indexterm" name="id2989713"></a><pre class="programlisting"><a class="link" href="glib-IO-Channels.html#GIOChannel">GIOChannel</a>*         g_io_channel_ref                    (<a class="link" href="glib-IO-Channels.html#GIOChannel">GIOChannel</a> *channel);</pre>
<p>
Increments the reference count of a <a class="link" href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>channel</code></em>&#160;:</span></p></td>
<td>a <a class="link" href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a>.
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
<td> the <em class="parameter"><code>channel</code></em> that was passed in (since 2.6)


</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2989792"></a><h3>
<a name="g-io-channel-unref"></a>g_io_channel_unref ()</h3>
<a class="indexterm" name="id2989805"></a><pre class="programlisting">void                g_io_channel_unref                  (<a class="link" href="glib-IO-Channels.html#GIOChannel">GIOChannel</a> *channel);</pre>
<p>
Decrements the reference count of a <a class="link" href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><em class="parameter"><code>channel</code></em>&#160;:</span></p></td>
<td>a <a class="link" href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a>.


</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2989867"></a><h3>
<a name="g-io-create-watch"></a>g_io_create_watch ()</h3>
<a class="indexterm" name="id2989881"></a><pre class="programlisting"><a class="link" href="glib-The-Main-Event-Loop.html#GSource">GSource</a>*            g_io_create_watch                   (<a class="link" href="glib-IO-Channels.html#GIOChannel">GIOChannel</a> *channel,
                                                         <a class="link" href="glib-IO-Channels.html#GIOCondition">GIOCondition</a> condition);</pre>
<p>
Creates a <a class="link" href="glib-The-Main-Event-Loop.html#GSource"><span class="type">GSource</span></a> that's dispatched when <em class="parameter"><code>condition</code></em> is met for the given
<em class="parameter"><code>channel</code></em>. For example, if condition is <a class="link" href="glib-IO-Channels.html#G-IO-IN:CAPS"><span class="type">G_IO_IN</span></a>, the source will be dispatched
when there's data available for reading.  <a class="link" href="glib-IO-Channels.html#g-io-add-watch"><code class="function">g_io_add_watch()</code></a> is a simpler
interface to this same functionality, for the case where you want to add the
source to the default main loop at the default priority.
</p>
<p>
On Windows, polling a <a class="link" href="glib-The-Main-Event-Loop.html#GSource"><span class="type">GSource</span></a> created to watch a channel for a socket
puts the socket in non-blocking mode. This is a side-effect of the
implementation and unavoidable.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>channel</code></em>&#160;:</span></p></td>
<td>a <a class="link" href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a> to watch
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>condition</code></em>&#160;:</span></p></td>
<td>conditions to watch for
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
<td>a new <a class="link" href="glib-The-Main-Event-Loop.html#GSource"><span class="type">GSource</span></a>


</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2990033"></a><h3>
<a name="g-io-add-watch"></a>g_io_add_watch ()</h3>
<a class="indexterm" name="id2990046"></a><pre class="programlisting"><a class="link" href="glib-Basic-Types.html#guint">guint</a>               g_io_add_watch                      (<a class="link" href="glib-IO-Channels.html#GIOChannel">GIOChannel</a> *channel,
                                                         <a class="link" href="glib-IO-Channels.html#GIOCondition">GIOCondition</a> condition,
                                                         <a class="link" href="glib-IO-Channels.html#GIOFunc">GIOFunc</a> func,
                                                         <a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> user_data);</pre>
<p>
Adds the <a class="link" href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a> into the
<a class="link" href="glib-The-Main-Event-Loop.html" title="The Main Event Loop">main event loop</a>
with the default priority.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>channel</code></em>&#160;:</span></p></td>
<td>a <a class="link" href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>condition</code></em>&#160;:</span></p></td>
<td>the condition to watch for
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>func</code></em>&#160;:</span></p></td>
<td>the function to call when the condition is satisfied
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>user_data</code></em>&#160;:</span></p></td>
<td>user data to pass to <em class="parameter"><code>func</code></em>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
<td>the event source id


</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2990199"></a><h3>
<a name="g-io-add-watch-full"></a>g_io_add_watch_full ()</h3>
<a class="indexterm" name="id2990212"></a><pre class="programlisting"><a class="link" href="glib-Basic-Types.html#guint">guint</a>               g_io_add_watch_full                 (<a class="link" href="glib-IO-Channels.html#GIOChannel">GIOChannel</a> *channel,
                                                         <a class="link" href="glib-Basic-Types.html#gint">gint</a> priority,
                                                         <a class="link" href="glib-IO-Channels.html#GIOCondition">GIOCondition</a> condition,
                                                         <a class="link" href="glib-IO-Channels.html#GIOFunc">GIOFunc</a> func,
                                                         <a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> user_data,
                                                         <a class="link" href="glib-Datasets.html#GDestroyNotify">GDestroyNotify</a> notify);</pre>
<p>
Adds the <a class="link" href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a> into the
<a class="link" href="glib-The-Main-Event-Loop.html" title="The Main Event Loop">main event loop</a>
with the given priority.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>channel</code></em>&#160;:</span></p></td>
<td>a <a class="link" href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>priority</code></em>&#160;:</span></p></td>
<td>the priority of the <a class="link" href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a> source
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>condition</code></em>&#160;:</span></p></td>
<td>the condition to watch for
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>func</code></em>&#160;:</span></p></td>
<td>the function to call when the condition is satisfied
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>user_data</code></em>&#160;:</span></p></td>
<td>user data to pass to <em class="parameter"><code>func</code></em>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>notify</code></em>&#160;:</span></p></td>
<td>the function to call when the source is removed
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
<td>the event source id


</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2990418"></a><h3>
<a name="GIOCondition"></a>enum GIOCondition</h3>
<a class="indexterm" name="id2990431"></a><pre class="programlisting">typedef enum
{
  G_IO_IN	GLIB_SYSDEF_POLLIN,
  G_IO_OUT	GLIB_SYSDEF_POLLOUT,
  G_IO_PRI	GLIB_SYSDEF_POLLPRI,
  G_IO_ERR	GLIB_SYSDEF_POLLERR,
  G_IO_HUP	GLIB_SYSDEF_POLLHUP,
  G_IO_NVAL	GLIB_SYSDEF_POLLNVAL
} GIOCondition;
</pre>
<p>
A bitwise combination representing a condition to watch for on 
an event source.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><a name="G-IO-IN:CAPS"></a><code class="literal">G_IO_IN</code></span></p></td>
<td>There is data to read.
</td>
</tr>
<tr>
<td><p><span class="term"><a name="G-IO-OUT:CAPS"></a><code class="literal">G_IO_OUT</code></span></p></td>
<td>Data can be written (without blocking).
</td>
</tr>
<tr>
<td><p><span class="term"><a name="G-IO-PRI:CAPS"></a><code class="literal">G_IO_PRI</code></span></p></td>
<td>There is urgent data to read.
</td>
</tr>
<tr>
<td><p><span class="term"><a name="G-IO-ERR:CAPS"></a><code class="literal">G_IO_ERR</code></span></p></td>
<td>Error condition.
</td>
</tr>
<tr>
<td><p><span class="term"><a name="G-IO-HUP:CAPS"></a><code class="literal">G_IO_HUP</code></span></p></td>
<td>Hung up (the connection has been broken, usually for pipes 
           and sockets).
</td>
</tr>
<tr>
<td><p><span class="term"><a name="G-IO-NVAL:CAPS"></a><code class="literal">G_IO_NVAL</code></span></p></td>
<td>Invalid request. The file descriptor is not open.

</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2990590"></a><h3>
<a name="GIOFunc"></a>GIOFunc ()</h3>
<a class="indexterm" name="id2990602"></a><pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean">gboolean</a>            (*GIOFunc)                          (<a class="link" href="glib-IO-Channels.html#GIOChannel">GIOChannel</a> *source,
                                                         <a class="link" href="glib-IO-Channels.html#GIOCondition">GIOCondition</a> condition,
                                                         <a class="link" href="glib-Basic-Types.html#gpointer">gpointer</a> data);</pre>
<p>
Specifies the type of function passed to <a class="link" href="glib-IO-Channels.html#g-io-add-watch"><code class="function">g_io_add_watch()</code></a> or
<a class="link" href="glib-IO-Channels.html#g-io-add-watch-full"><code class="function">g_io_add_watch_full()</code></a>, which is called when the requested 
condition on a <a class="link" href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a> is satisfied.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>source</code></em>&#160;:</span></p></td>
<td>the <a class="link" href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a> event source
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>condition</code></em>&#160;:</span></p></td>
<td>the condition which has been satisfied
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>data</code></em>&#160;:</span></p></td>
<td>user data set in <a class="link" href="glib-IO-Channels.html#g-io-add-watch"><code class="function">g_io_add_watch()</code></a> or <a class="link" href="glib-IO-Channels.html#g-io-add-watch-full"><code class="function">g_io_add_watch_full()</code></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
<td>the function should return <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> if the event source 
  should be removed


</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2990774"></a><h3>
<a name="GIOFuncs"></a>GIOFuncs</h3>
<a class="indexterm" name="id2990787"></a><pre class="programlisting">typedef struct {
  GIOStatus (*io_read)           (GIOChannel   *channel, 
			          gchar        *buf, 
				  gsize         count,
				  gsize        *bytes_read,
				  GError      **err);
  GIOStatus (*io_write)          (GIOChannel   *channel, 
				  const gchar  *buf, 
				  gsize         count,
				  gsize        *bytes_written,
				  GError      **err);
  GIOStatus (*io_seek)           (GIOChannel   *channel, 
				  gint64        offset, 
				  GSeekType     type,
				  GError      **err);
  GIOStatus  (*io_close)         (GIOChannel   *channel,
				  GError      **err);
  GSource*   (*io_create_watch)  (GIOChannel   *channel,
				  GIOCondition  condition);
  void       (*io_free)          (GIOChannel   *channel);
  GIOStatus  (*io_set_flags)     (GIOChannel   *channel,
                                  GIOFlags      flags,
				  GError      **err);
  GIOFlags   (*io_get_flags)     (GIOChannel   *channel);
} GIOFuncs;
</pre>
<p>
A table of functions used to handle different types of <a class="link" href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a> 
in a generic way.
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2990827"></a><h3>
<a name="g-io-channel-get-buffer-size"></a>g_io_channel_get_buffer_size ()</h3>
<a class="indexterm" name="id2990840"></a><pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gsize">gsize</a>               g_io_channel_get_buffer_size        (<a class="link" href="glib-IO-Channels.html#GIOChannel">GIOChannel</a> *channel);</pre>
<p>
Gets the buffer size.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>channel</code></em>&#160;:</span></p></td>
<td> a <a class="link" href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
<td> the size of the buffer.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2990909"></a><h3>
<a name="g-io-channel-set-buffer-size"></a>g_io_channel_set_buffer_size ()</h3>
<a class="indexterm" name="id2990923"></a><pre class="programlisting">void                g_io_channel_set_buffer_size        (<a class="link" href="glib-IO-Channels.html#GIOChannel">GIOChannel</a> *channel,
                                                         <a class="link" href="glib-Basic-Types.html#gsize">gsize</a> size);</pre>
<p>
Sets the buffer size.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>channel</code></em>&#160;:</span></p></td>
<td> a <a class="link" href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>size</code></em>&#160;:</span></p></td>
<td> the size of the buffer, or 0 to let GLib pick a good size
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2991003"></a><h3>
<a name="g-io-channel-get-buffer-condition"></a>g_io_channel_get_buffer_condition ()</h3>
<a class="indexterm" name="id2991018"></a><pre class="programlisting"><a class="link" href="glib-IO-Channels.html#GIOCondition">GIOCondition</a>        g_io_channel_get_buffer_condition   (<a class="link" href="glib-IO-Channels.html#GIOChannel">GIOChannel</a> *channel);</pre>
<p>
This function returns a <a class="link" href="glib-IO-Channels.html#GIOCondition"><span class="type">GIOCondition</span></a> depending on whether there
is data to be read/space to write data in the internal buffers in 
the <a class="link" href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a>. Only the flags <a class="link" href="glib-IO-Channels.html#G-IO-IN:CAPS"><code class="literal">G_IO_IN</code></a> and <a class="link" href="glib-IO-Channels.html#G-IO-OUT:CAPS"><code class="literal">G_IO_OUT</code></a> may be set.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>channel</code></em>&#160;:</span></p></td>
<td> A <a class="link" href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
<td> A <a class="link" href="glib-IO-Channels.html#GIOCondition"><span class="type">GIOCondition</span></a>
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2991132"></a><h3>
<a name="g-io-channel-get-flags"></a>g_io_channel_get_flags ()</h3>
<a class="indexterm" name="id2991146"></a><pre class="programlisting"><a class="link" href="glib-IO-Channels.html#GIOFlags">GIOFlags</a>            g_io_channel_get_flags              (<a class="link" href="glib-IO-Channels.html#GIOChannel">GIOChannel</a> *channel);</pre>
<p>
Gets the current flags for a <a class="link" href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a>, including read-only
flags such as <a class="link" href="glib-IO-Channels.html#G-IO-FLAG-IS-READABLE:CAPS"><code class="literal">G_IO_FLAG_IS_READABLE</code></a>.
</p>
<p>
The values of the flags <a class="link" href="glib-IO-Channels.html#G-IO-FLAG-IS-READABLE:CAPS"><code class="literal">G_IO_FLAG_IS_READABLE</code></a> and <a class="link" href="glib-IO-Channels.html#G-IO-FLAG-IS-WRITEABLE:CAPS"><code class="literal">G_IO_FLAG_IS_WRITEABLE</code></a>
are cached for internal use by the channel when it is created.
If they should change at some later point (e.g. partial shutdown
of a socket with the UNIX <code class="function">shutdown()</code> function), the user
should immediately call <a class="link" href="glib-IO-Channels.html#g-io-channel-get-flags"><code class="function">g_io_channel_get_flags()</code></a> to update
the internal values of these flags.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>channel</code></em>&#160;:</span></p></td>
<td> a <a class="link" href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
<td> the flags which are set on the channel
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2991289"></a><h3>
<a name="g-io-channel-set-flags"></a>g_io_channel_set_flags ()</h3>
<a class="indexterm" name="id2991302"></a><pre class="programlisting"><a class="link" href="glib-IO-Channels.html#GIOStatus">GIOStatus</a>           g_io_channel_set_flags              (<a class="link" href="glib-IO-Channels.html#GIOChannel">GIOChannel</a> *channel,
                                                         <a class="link" href="glib-IO-Channels.html#GIOFlags">GIOFlags</a> flags,
                                                         <a class="link" href="glib-Error-Reporting.html#GError">GError</a> **error);</pre>
<p>
Sets the (writeable) flags in <em class="parameter"><code>channel</code></em> to (<em class="parameter"><code>flags</code></em> &amp; <code class="literal">G_IO_CHANNEL_SET_MASK</code>).</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>channel</code></em>&#160;:</span></p></td>
<td> a <a class="link" href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>flags</code></em>&#160;:</span></p></td>
<td> the flags to set on the IO channel
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>error</code></em>&#160;:</span></p></td>
<td> A location to return an error of type <a class="link" href="glib-IO-Channels.html#GIOChannelError"><span class="type">GIOChannelError</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
<td> the status of the operation. 
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2991447"></a><h3>
<a name="GIOFlags"></a>enum GIOFlags</h3>
<a class="indexterm" name="id2991460"></a><pre class="programlisting">typedef enum
{
  G_IO_FLAG_APPEND = 1 &lt;&lt; 0,
  G_IO_FLAG_NONBLOCK = 1 &lt;&lt; 1,
  G_IO_FLAG_IS_READABLE = 1 &lt;&lt; 2,	/* Read only flag */
  G_IO_FLAG_IS_WRITEABLE = 1 &lt;&lt; 3,	/* Read only flag */
  G_IO_FLAG_IS_SEEKABLE = 1 &lt;&lt; 4,	/* Read only flag */
  G_IO_FLAG_MASK = (1 &lt;&lt; 5) - 1,
  G_IO_FLAG_GET_MASK = G_IO_FLAG_MASK,
  G_IO_FLAG_SET_MASK = G_IO_FLAG_APPEND | G_IO_FLAG_NONBLOCK
} GIOFlags;
</pre>
<p>
Specifies properties of a <a class="link" href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a>. Some of the flags can only
be read with <a class="link" href="glib-IO-Channels.html#g-io-channel-get-flags"><code class="function">g_io_channel_get_flags()</code></a>, but not changed with
<a class="link" href="glib-IO-Channels.html#g-io-channel-set-flags"><code class="function">g_io_channel_set_flags()</code></a>. 
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><a name="G-IO-FLAG-APPEND:CAPS"></a><code class="literal">G_IO_FLAG_APPEND</code></span></p></td>
<td>turns on append mode, corresponds to <code class="literal">O_APPEND</code> 
  (see the documentation of the UNIX <code class="function">open()</code> syscall).
</td>
</tr>
<tr>
<td><p><span class="term"><a name="G-IO-FLAG-NONBLOCK:CAPS"></a><code class="literal">G_IO_FLAG_NONBLOCK</code></span></p></td>
<td>turns on nonblocking mode, corresponds to 
  <code class="literal">O_NONBLOCK</code>/<code class="literal">O_NDELAY</code> (see the documentation of the UNIX <code class="function">open()</code> 
  syscall).
</td>
</tr>
<tr>
<td><p><span class="term"><a name="G-IO-FLAG-IS-READABLE:CAPS"></a><code class="literal">G_IO_FLAG_IS_READABLE</code></span></p></td>
<td>indicates that the io channel is readable. 
  This flag can not be changed.
</td>
</tr>
<tr>
<td><p><span class="term"><a name="G-IO-FLAG-IS-WRITEABLE:CAPS"></a><code class="literal">G_IO_FLAG_IS_WRITEABLE</code></span></p></td>
<td>indicates that the io channel is writable. 
  This flag can not be changed.
</td>
</tr>
<tr>
<td><p><span class="term"><a name="G-IO-FLAG-IS-SEEKABLE:CAPS"></a><code class="literal">G_IO_FLAG_IS_SEEKABLE</code></span></p></td>
<td>indicates that the io channel is seekable, 
  i.e. that <a class="link" href="glib-IO-Channels.html#g-io-channel-seek-position"><code class="function">g_io_channel_seek_position()</code></a> can be used on it. 
  This flag can not be changed.
</td>
</tr>
<tr>
<td><p><span class="term"><a name="G-IO-FLAG-MASK:CAPS"></a><code class="literal">G_IO_FLAG_MASK</code></span></p></td>
<td>
</td>
</tr>
<tr>
<td><p><span class="term"><a name="G-IO-FLAG-GET-MASK:CAPS"></a><code class="literal">G_IO_FLAG_GET_MASK</code></span></p></td>
<td>
</td>
</tr>
<tr>
<td><p><span class="term"><a name="G-IO-FLAG-SET-MASK:CAPS"></a><code class="literal">G_IO_FLAG_SET_MASK</code></span></p></td>
<td>

</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2991772"></a><h3>
<a name="g-io-channel-get-line-term"></a>g_io_channel_get_line_term ()</h3>
<a class="indexterm" name="id2991785"></a><pre class="programlisting">const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a>*        g_io_channel_get_line_term          (<a class="link" href="glib-IO-Channels.html#GIOChannel">GIOChannel</a> *channel,
                                                         <a class="link" href="glib-Basic-Types.html#gint">gint</a> *length);</pre>
<p>
This returns the string that <a class="link" href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a> uses to determine
where in the file a line break occurs. A value of <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>
indicates autodetection.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>channel</code></em>&#160;:</span></p></td>
<td> a <a class="link" href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>length</code></em>&#160;:</span></p></td>
<td> a location to return the length of the line terminator
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
<td> The line termination string. This value
  is owned by GLib and must not be freed.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2991897"></a><h3>
<a name="g-io-channel-set-line-term"></a>g_io_channel_set_line_term ()</h3>
<a class="indexterm" name="id2991911"></a><pre class="programlisting">void                g_io_channel_set_line_term          (<a class="link" href="glib-IO-Channels.html#GIOChannel">GIOChannel</a> *channel,
                                                         const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *line_term,
                                                         <a class="link" href="glib-Basic-Types.html#gint">gint</a> length);</pre>
<p>
This sets the string that <a class="link" href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a> uses to determine
where in the file a line break occurs.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>channel</code></em>&#160;:</span></p></td>
<td> a <a class="link" href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>line_term</code></em>&#160;:</span></p></td>
<td> The line termination string. Use <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> for autodetect.
            Autodetection breaks on "\n", "\r\n", "\r", "\0", and
            the Unicode paragraph separator. Autodetection should
            not be used for anything other than file-based channels.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>length</code></em>&#160;:</span></p></td>
<td> The length of the termination string. If -1 is passed, the
         string is assumed to be nul-terminated. This option allows
         termination strings with embedded nuls.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2992038"></a><h3>
<a name="g-io-channel-get-buffered"></a>g_io_channel_get_buffered ()</h3>
<a class="indexterm" name="id2992052"></a><pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean">gboolean</a>            g_io_channel_get_buffered           (<a class="link" href="glib-IO-Channels.html#GIOChannel">GIOChannel</a> *channel);</pre>
<p>
Returns whether <em class="parameter"><code>channel</code></em> is buffered.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>channel</code></em>&#160;:</span></p></td>
<td> a <a class="link" href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
<td> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the <em class="parameter"><code>channel</code></em> is buffered. 
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2992141"></a><h3>
<a name="g-io-channel-set-buffered"></a>g_io_channel_set_buffered ()</h3>
<a class="indexterm" name="id2992155"></a><pre class="programlisting">void                g_io_channel_set_buffered           (<a class="link" href="glib-IO-Channels.html#GIOChannel">GIOChannel</a> *channel,
                                                         <a class="link" href="glib-Basic-Types.html#gboolean">gboolean</a> buffered);</pre>
<p>
The buffering state can only be set if the channel's encoding
is <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. For any other encoding, the channel must be buffered.
</p>
<p>
A buffered channel can only be set unbuffered if the channel's
internal buffers have been flushed. Newly created channels or
channels which have returned <a class="link" href="glib-IO-Channels.html#G-IO-STATUS-EOF:CAPS"><code class="literal">G_IO_STATUS_EOF</code></a>
not require such a flush. For write-only channels, a call to
<a class="link" href="glib-IO-Channels.html#g-io-channel-flush"><code class="function">g_io_channel_flush()</code></a> is sufficient. For all other channels,
the buffers may be flushed by a call to <a class="link" href="glib-IO-Channels.html#g-io-channel-seek-position"><code class="function">g_io_channel_seek_position()</code></a>.
This includes the possibility of seeking with seek type <a class="link" href="glib-IO-Channels.html#G-SEEK-CUR:CAPS"><code class="literal">G_SEEK_CUR</code></a>
and an offset of zero. Note that this means that socket-based
channels cannot be set unbuffered once they have had data
read from them.
</p>
<p>
On unbuffered channels, it is safe to mix read and write
calls from the new and old APIs, if this is necessary for
maintaining old code.
</p>
<p>
The default state of the channel is buffered.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>channel</code></em>&#160;:</span></p></td>
<td> a <a class="link" href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>buffered</code></em>&#160;:</span></p></td>
<td> whether to set the channel buffered or unbuffered
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2992311"></a><h3>
<a name="g-io-channel-get-encoding"></a>g_io_channel_get_encoding ()</h3>
<a class="indexterm" name="id2992325"></a><pre class="programlisting">const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a>*        g_io_channel_get_encoding           (<a class="link" href="glib-IO-Channels.html#GIOChannel">GIOChannel</a> *channel);</pre>
<p>
Gets the encoding for the input/output of the channel. 
The internal encoding is always UTF-8. The encoding <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> 
makes the channel safe for binary data.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>channel</code></em>&#160;:</span></p></td>
<td> a <a class="link" href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
<td> A string containing the encoding, this string is
  owned by GLib and must not be freed.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2992407"></a><h3>
<a name="g-io-channel-set-encoding"></a>g_io_channel_set_encoding ()</h3>
<a class="indexterm" name="id2992421"></a><pre class="programlisting"><a class="link" href="glib-IO-Channels.html#GIOStatus">GIOStatus</a>           g_io_channel_set_encoding           (<a class="link" href="glib-IO-Channels.html#GIOChannel">GIOChannel</a> *channel,
                                                         const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *encoding,
                                                         <a class="link" href="glib-Error-Reporting.html#GError">GError</a> **error);</pre>
<p>
Sets the encoding for the input/output of the channel. 
The internal encoding is always UTF-8. The default encoding 
for the external file is UTF-8.
</p>
<p>
The encoding <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> is safe to use with binary data.
</p>
<p>
The encoding can only be set if one of the following conditions
is true:
</p>
<div class="itemizedlist"><ul type="disc">
<li><p>
   The channel was just created, and has not been written to or read 
   from yet.
</p></li>
<li><p>
   The channel is write-only.
</p></li>
<li><p>
   The channel is a file, and the file pointer was just
   repositioned by a call to <a class="link" href="glib-IO-Channels.html#g-io-channel-seek-position"><code class="function">g_io_channel_seek_position()</code></a>.
   (This flushes all the internal buffers.)
</p></li>
<li><p>
   The current encoding is <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> or UTF-8.
</p></li>
<li><p>
   One of the (new API) read functions has just returned <a class="link" href="glib-IO-Channels.html#G-IO-STATUS-EOF:CAPS"><code class="literal">G_IO_STATUS_EOF</code></a>
   (or, in the case of <a class="link" href="glib-IO-Channels.html#g-io-channel-read-to-end"><code class="function">g_io_channel_read_to_end()</code></a>, <a class="link" href="glib-IO-Channels.html#G-IO-STATUS-NORMAL:CAPS"><code class="literal">G_IO_STATUS_NORMAL</code></a>).
</p></li>
<li><p>
   One of the functions <a class="link" href="glib-IO-Channels.html#g-io-channel-read-chars"><code class="function">g_io_channel_read_chars()</code></a> or 
   <a class="link" href="glib-IO-Channels.html#g-io-channel-read-unichar"><code class="function">g_io_channel_read_unichar()</code></a> has returned <a class="link" href="glib-IO-Channels.html#G-IO-STATUS-AGAIN:CAPS"><code class="literal">G_IO_STATUS_AGAIN</code></a> or 
   <a class="link" href="glib-IO-Channels.html#G-IO-STATUS-ERROR:CAPS"><code class="literal">G_IO_STATUS_ERROR</code></a>. This may be useful in the case of 
   <a class="link" href="glib-Character-Set-Conversion.html#G-CONVERT-ERROR-ILLEGAL-SEQUENCE:CAPS"><code class="literal">G_CONVERT_ERROR_ILLEGAL_SEQUENCE</code></a>.
   Returning one of these statuses from <a class="link" href="glib-IO-Channels.html#g-io-channel-read-line"><code class="function">g_io_channel_read_line()</code></a>,
   <a class="link" href="glib-IO-Channels.html#g-io-channel-read-line-string"><code class="function">g_io_channel_read_line_string()</code></a>, or <a class="link" href="glib-IO-Channels.html#g-io-channel-read-to-end"><code class="function">g_io_channel_read_to_end()</code></a>
   does <span class="emphasis"><em>not</em></span> guarantee that the encoding can 
   be changed.
</p></li>
</ul></div>
<p>
Channels which do not meet one of the above conditions cannot call
<a class="link" href="glib-IO-Channels.html#g-io-channel-seek-position"><code class="function">g_io_channel_seek_position()</code></a> with an offset of <a class="link" href="glib-IO-Channels.html#G-SEEK-CUR:CAPS"><code class="literal">G_SEEK_CUR</code></a>, and, if 
they are "seekable", cannot call <a class="link" href="glib-IO-Channels.html#g-io-channel-write-chars"><code class="function">g_io_channel_write_chars()</code></a> after 
calling one of the API "read" functions.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>channel</code></em>&#160;:</span></p></td>
<td> a <a class="link" href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>encoding</code></em>&#160;:</span></p></td>
<td> the encoding type
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>error</code></em>&#160;:</span></p></td>
<td> location to store an error of type <a class="link" href="glib-Character-Set-Conversion.html#GConvertError"><span class="type">GConvertError</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
<td> <a class="link" href="glib-IO-Channels.html#G-IO-STATUS-NORMAL:CAPS"><code class="literal">G_IO_STATUS_NORMAL</code></a> if the encoding was successfully set.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2992797"></a><h3>
<a name="g-io-channel-get-close-on-unref"></a>g_io_channel_get_close_on_unref ()</h3>
<a class="indexterm" name="id2992810"></a><pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean">gboolean</a>            g_io_channel_get_close_on_unref     (<a class="link" href="glib-IO-Channels.html#GIOChannel">GIOChannel</a> *channel);</pre>
<p>
Returns whether the file/socket/whatever associated with <em class="parameter"><code>channel</code></em>
will be closed when <em class="parameter"><code>channel</code></em> receives its final unref and is
destroyed. The default value of this is <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> for channels created
by <a class="link" href="glib-IO-Channels.html#g-io-channel-new-file"><code class="function">g_io_channel_new_file()</code></a>, and <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> for all other channels.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>channel</code></em>&#160;:</span></p></td>
<td> a <a class="link" href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a>.
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
<td> Whether the channel will be closed on the final unref of
              the GIOChannel data structure.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2992926"></a><h3>
<a name="g-io-channel-set-close-on-unref"></a>g_io_channel_set_close_on_unref ()</h3>
<a class="indexterm" name="id2992940"></a><pre class="programlisting">void                g_io_channel_set_close_on_unref     (<a class="link" href="glib-IO-Channels.html#GIOChannel">GIOChannel</a> *channel,
                                                         <a class="link" href="glib-Basic-Types.html#gboolean">gboolean</a> do_close);</pre>
<p>
Setting this flag to <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> for a channel you have already closed
can cause problems.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>channel</code></em>&#160;:</span></p></td>
<td> a <a class="link" href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>do_close</code></em>&#160;:</span></p></td>
<td> Whether to close the channel on the final unref of
           the GIOChannel data structure. The default value of
           this is <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> for channels created by <a class="link" href="glib-IO-Channels.html#g-io-channel-new-file"><code class="function">g_io_channel_new_file()</code></a>,
           and <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> for all other channels.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2993065"></a><h3>
<a name="g-io-channel-read"></a>g_io_channel_read ()</h3>
<a class="indexterm" name="id2993082"></a><pre class="programlisting"><a class="link" href="glib-IO-Channels.html#GIOError">GIOError</a>            g_io_channel_read                   (<a class="link" href="glib-IO-Channels.html#GIOChannel">GIOChannel</a> *channel,
                                                         <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *buf,
                                                         <a class="link" href="glib-Basic-Types.html#gsize">gsize</a> count,
                                                         <a class="link" href="glib-Basic-Types.html#gsize">gsize</a> *bytes_read);</pre>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Warning</h3>
<p><code class="literal">g_io_channel_read</code> has been deprecated since version 2.2 and should not be used in newly-written code. Use <a class="link" href="glib-IO-Channels.html#g-io-channel-read-chars"><code class="function">g_io_channel_read_chars()</code></a> instead.</p>
</div>
<p>
Reads data from a <a class="link" href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a>.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>channel</code></em>&#160;:</span></p></td>
<td> a <a class="link" href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>buf</code></em>&#160;:</span></p></td>
<td> a buffer to read the data into (which should be at least 
      count bytes long)
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>count</code></em>&#160;:</span></p></td>
<td> the number of bytes to read from the <a class="link" href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>bytes_read</code></em>&#160;:</span></p></td>
<td> returns the number of bytes actually read
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
<td> <a class="link" href="glib-IO-Channels.html#G-IO-ERROR-NONE:CAPS"><code class="literal">G_IO_ERROR_NONE</code></a> if the operation was successful. 

</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2993269"></a><h3>
<a name="GIOError"></a>enum GIOError</h3>
<a class="indexterm" name="id2993281"></a><pre class="programlisting">typedef enum
{
  G_IO_ERROR_NONE,
  G_IO_ERROR_AGAIN,
  G_IO_ERROR_INVAL,
  G_IO_ERROR_UNKNOWN
} GIOError;
</pre>
<p>
<a class="link" href="glib-IO-Channels.html#GIOError"><span class="type">GIOError</span></a> is only used by the deprecated functions <a class="link" href="glib-IO-Channels.html#g-io-channel-read"><code class="function">g_io_channel_read()</code></a>,
<a class="link" href="glib-IO-Channels.html#g-io-channel-write"><code class="function">g_io_channel_write()</code></a>, and <a class="link" href="glib-IO-Channels.html#g-io-channel-seek"><code class="function">g_io_channel_seek()</code></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><a name="G-IO-ERROR-NONE:CAPS"></a><code class="literal">G_IO_ERROR_NONE</code></span></p></td>
<td>no error
</td>
</tr>
<tr>
<td><p><span class="term"><a name="G-IO-ERROR-AGAIN:CAPS"></a><code class="literal">G_IO_ERROR_AGAIN</code></span></p></td>
<td>an EAGAIN error occurred
</td>
</tr>
<tr>
<td><p><span class="term"><a name="G-IO-ERROR-INVAL:CAPS"></a><code class="literal">G_IO_ERROR_INVAL</code></span></p></td>
<td>an EINVAL error occurred
</td>
</tr>
<tr>
<td><p><span class="term"><a name="G-IO-ERROR-UNKNOWN:CAPS"></a><code class="literal">G_IO_ERROR_UNKNOWN</code></span></p></td>
<td>another error occurred

</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2993432"></a><h3>
<a name="g-io-channel-write"></a>g_io_channel_write ()</h3>
<a class="indexterm" name="id2993449"></a><pre class="programlisting"><a class="link" href="glib-IO-Channels.html#GIOError">GIOError</a>            g_io_channel_write                  (<a class="link" href="glib-IO-Channels.html#GIOChannel">GIOChannel</a> *channel,
                                                         const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *buf,
                                                         <a class="link" href="glib-Basic-Types.html#gsize">gsize</a> count,
                                                         <a class="link" href="glib-Basic-Types.html#gsize">gsize</a> *bytes_written);</pre>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Warning</h3>
<p><code class="literal">g_io_channel_write</code> has been deprecated since version 2.2 and should not be used in newly-written code. Use <a class="link" href="glib-IO-Channels.html#g-io-channel-write-chars"><code class="function">g_io_channel_write_chars()</code></a> instead.</p>
</div>
<p>
Writes data to a <a class="link" href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a>.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>channel</code></em>&#160;:</span></p></td>
<td>  a <a class="link" href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>buf</code></em>&#160;:</span></p></td>
<td> the buffer containing the data to write
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>count</code></em>&#160;:</span></p></td>
<td> the number of bytes to write
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>bytes_written</code></em>&#160;:</span></p></td>
<td> the number of bytes actually written
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
<td>  <a class="link" href="glib-IO-Channels.html#G-IO-ERROR-NONE:CAPS"><code class="literal">G_IO_ERROR_NONE</code></a> if the operation was successful.

</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2993626"></a><h3>
<a name="g-io-channel-seek"></a>g_io_channel_seek ()</h3>
<a class="indexterm" name="id2993642"></a><pre class="programlisting"><a class="link" href="glib-IO-Channels.html#GIOError">GIOError</a>            g_io_channel_seek                   (<a class="link" href="glib-IO-Channels.html#GIOChannel">GIOChannel</a> *channel,
                                                         <a class="link" href="glib-Basic-Types.html#gint64">gint64</a> offset,
                                                         <a class="link" href="glib-IO-Channels.html#GSeekType">GSeekType</a> type);</pre>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Warning</h3>
<p><code class="literal">g_io_channel_seek</code> has been deprecated since version 2.2 and should not be used in newly-written code. Use <a class="link" href="glib-IO-Channels.html#g-io-channel-seek-position"><code class="function">g_io_channel_seek_position()</code></a> instead.</p>
</div>
<p>
Sets the current position in the <a class="link" href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a>, similar to the standard 
library function <code class="function">fseek()</code>.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>channel</code></em>&#160;:</span></p></td>
<td> a <a class="link" href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>offset</code></em>&#160;:</span></p></td>
<td> an offset, in bytes, which is added to the position specified 
         by <em class="parameter"><code>type</code></em>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>type</code></em>&#160;:</span></p></td>
<td> the position in the file, which can be <a class="link" href="glib-IO-Channels.html#G-SEEK-CUR:CAPS"><code class="literal">G_SEEK_CUR</code></a> (the current
       position), <a class="link" href="glib-IO-Channels.html#G-SEEK-SET:CAPS"><code class="literal">G_SEEK_SET</code></a> (the start of the file), or <a class="link" href="glib-IO-Channels.html#G-SEEK-END:CAPS"><code class="literal">G_SEEK_END</code></a> 
       (the end of the file)
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
<td> <a class="link" href="glib-IO-Channels.html#G-IO-ERROR-NONE:CAPS"><code class="literal">G_IO_ERROR_NONE</code></a> if the operation was successful.

</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2993852"></a><h3>
<a name="g-io-channel-close"></a>g_io_channel_close ()</h3>
<a class="indexterm" name="id2993868"></a><pre class="programlisting">void                g_io_channel_close                  (<a class="link" href="glib-IO-Channels.html#GIOChannel">GIOChannel</a> *channel);</pre>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Warning</h3>
<p><code class="literal">g_io_channel_close</code> has been deprecated since version 2.2 and should not be used in newly-written code. Use <a class="link" href="glib-IO-Channels.html#g-io-channel-shutdown"><code class="function">g_io_channel_shutdown()</code></a> instead.</p>
</div>
<p>
Close an IO channel. Any pending data to be written will be
flushed, ignoring errors. The channel will not be freed until the
last reference is dropped using <a class="link" href="glib-IO-Channels.html#g-io-channel-unref"><code class="function">g_io_channel_unref()</code></a>.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><em class="parameter"><code>channel</code></em>&#160;:</span></p></td>
<td> A <a class="link" href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a>
</td>
</tr></tbody>
</table></div>
</div>
</div>
<div class="refsect1" lang="en">
<a name="id2993963"></a><h2>See Also</h2>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><a
href="/usr/share/gtk-doc/html/gtk/gtk-General.html#gtk-input-add-full"
><code class="function">gtk_input_add_full()</code></a>, <a
href="/usr/share/gtk-doc/html/gtk/gtk-General.html#gtk-input-remove"
><code class="function">gtk_input_remove()</code></a>, <a
href="/usr/share/gtk-doc/html/gdk/gdk-Input.html#gdk-input-add"
><code class="function">gdk_input_add()</code></a>,
<a
href="/usr/share/gtk-doc/html/gdk/gdk-Input.html#gdk-input-add-full"
><code class="function">gdk_input_add_full()</code></a>, <a
href="/usr/share/gtk-doc/html/gdk/gdk-Input.html#gdk-input-remove"
><code class="function">gdk_input_remove()</code></a></span></p></td>
<td><p>
Convenience functions for creating <a class="link" href="glib-IO-Channels.html#GIOChannel"><span class="type">GIOChannel</span></a> instances and adding them to the
<a class="link" href="glib-The-Main-Event-Loop.html" title="The Main Event Loop">main event loop</a>.
</p></td>
</tr></tbody>
</table></div>
<p>
</p>
</div>
<div class="refsect1" lang="en">
<a name="id2994061"></a><div class="refsect2" lang="en"><a name="id2994062"></a></div>
<hr>
<div class="refsect2" lang="en"><a name="id2994063"></a></div>
</div>
</div>
</body>
</html>
